<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<!-- 求和 -->
		<script type="text/javascript">
			let sum=0;
			let i=0;
			let arr = [2,3,4,5]
			arr.forEach(i => {
				sum = sum+i
			})
			console.log(sum)
			// 第二种方法
			var w=arr.reduce((f,g) => f+g)
			console.log(w)
			
			//第三种方法
			var d=arr.reduceRight((h,j)=> h+j)
			console.log(d)
		</script>
	</body>
</html>
